    (function($){
        $.noConflict();
        var localCache = {
            'data'    : {},
            'getHash' : function (url, postData) {
                return (url + postData.email + postData.game + postData.money + postData.currency);
            },
            'remove'  : function (hash) {
                delete localCache.data[hash];
            },
            'exist'   : function (hash) {
                return localCache.data.hasOwnProperty(hash) && localCache.data[hash] !== null;
            },
            'get'     : function (hash) {
    //            console.log('Getting in cache for url' + hash + ': ' + localCache.data[hash]);
                return localCache.data[hash];
            },
            'set'     : function (hash, cachedData, callback) {
                localCache.remove(hash);
                localCache.data[hash] = cachedData;
                if ($.isFunction(callback)) {
                    callback(cachedData);
                }
            }
        };

        var rb_add = {
        //	'RBK Money'								  :	'RuPayR',
        //	'Money-Mail'							  :	'MoneyMailR',
            'Единый кошелек'                         : 'W1R',
            'EasyPay'                                : 'EasyPayB',
            'Деньги@mail.ru'                         : 'MailRuOceanR',
        //	'ВКонтакте RUR'							  :	'VKontakteMerchantR',
        //	'CONTACT'								  :	'PCR',
        //	'RUR Z-Payment'							  :	'ZPaymentR',
            'WME'                                    : 'WMEM',
            'Webmoney WMU'                           : 'WMUM',
            'WMB'                                    : 'WMBM',
        //	'WMG'									  :	'WMGM',
            'Выставить счет в Альфа-Клик'            : 'AlfaBankOceanR',
            'МТС (оплата с баланса телефона)'        : 'MtsR',
            'Картой Visa и MasterCard (Robokassa)'   : 'BANKOCEAN2R',
            'Оплата наличными в Евросети'            : 'RapidaOceanEurosetR',
            'Оплата наличными в Связном'             : 'RapidaOceanSvyaznoyR',
            'Оплата через терминалы - Элекснет'      : 'TerminalsElecsnetOceanR',
            'Оплата через терминалы - Мобил Элемент' : 'TerminalsMElementR',
            'Оплата через терминалы - Кассира.нет'   : 'TerminalsKassira.NetOceanR',
            'Webmoney WMR'                           : 'WMR',
            'Webmoney WMZ'                           : 'WMZ',
            'ТeleMoney'                              : 'TeleMoneyR',
            'Банк "ПРОМСВЯЗЬБАНК"'                   : 'PSKBR',
            'Банк "ВТБ24"'                           : 'VTB24R',
            'Банк "HandyBank"'                       : 'HandyBankMerchantOceanR',
            'Банк "ТАТФОНДБАНК"'                     : 'BSSTatfondbankR',
            'Банк "Образование"'                     : 'HandyBankBO',
            'Банк "Интеза"'                          : 'BSSIntezaR',
            'Qiwi - кошелек "Все страны"'            : 'Qiwi29OceanR'

        };

        roboxComiss = {
            'RBK Money'                            : 1.07527,
            'Money-Mail'                           : 1.07527,
            'Единый кошелек'                       : 1.05264,
            'Деньги@mail.ru'                       : 1.09891,
            'ВКонтакте RUR'                        : 1.06383,
            'CONTACT'                              : 1.08041,
            'RUR Z-Payment'                        : 1.05264,
            'Выставить счет в Альфа-Клик'          : 1.07,
            'МТС (оплата с баланса телефона)'      : 1.07,
            'Картой Visa и MasterCard (Robokassa)' : 1.064,
            'Оплата наличными в Евросети'          : 1.08,
            'Оплата наличными в Связном'           : 1.08,
            'Webmoney WMR'                         : 1.02,
            'Webmoney WMZ'                         : 1.02,
            'Webmoney WMU'                         : 1.02,
            'WMB'                                  : 1.02,
            'WMG'                                  : 1.02,
            'WME'                                  : 1.02,
            'EasyPay'                              : 1.07,

            'Оплата через терминалы - Элекснет'      : 1.053,
            'Оплата через терминалы - Мобил Элемент' : 1.0476,
            'Оплата через терминалы - Кассира.нет'   : 1.0476,
            'ТeleMoney'                              : 1.0740,
            'Банк "ПРОМСВЯЗЬБАНК"'                   : 1.07,
            'Банк "ВТБ24"'                           : 1.07,
            'Банк "HandyBank"'                       : 1.064,
            'Банк "ТАТФОНДБАНК"'                     : 1.07,
            'Банк "Образование"'                     : 1.074,
            'Банк "Интеза"'                          : 1.07,
            'Qiwi - кошелек "Все страны"'            : 1.06803355079
        };
        var topAccumDiscount = {'discount_game' : 'all'};

        function TagElement(tagSelector) {
            var $element = $(tagSelector);
            this.hide = function () {
                $element.hide();

                return this;
            };
            this.show = function () {
                $element.show();

                return this;
            };
            this.html = function (htmlValue) {
                $element.html(htmlValue);

                return this;
            };
        }
        function TransferSelectBox(tagSelector) {
            const AUCTION_INSTRUCTION = 'Поставьте на аукцион любой лот на выкуп. Сумма выкупа должна быть ровна сумме вашего заказа + 10%. Название предмета укажите в комментарии ниже.';
            var
                $loginBlock         = new TagElement('#login-block'),
                $accountAlert       = new TagElement('#id-account-alert'),
                $auctiontAlert      = new TagElement('#id-auction-alert'),
                $userCommentLabel   = new TagElement('#CharacterCommentLabel'),
                $selectBox          = $(tagSelector),
                $tradeInstructions  = $('#tradeTypeInstructions'),
                serverToValue = {
                    'gold'       : 'viaExchange',
                    'brilliant'  : 'viaAuction'
                }
                ;
            this.onValueChange = function () {
                var selectedType = $selectBox.find('option:selected').val();
                $accountAlert.hide();

                if ('account' == selectedType) {
                    $loginBlock.show();
                    $accountAlert.show();
                    //$userCommentLabel.text('Время, когда оператор может зайти на ваш аккаунт:');
                } else {
                    if ('auction' == selectedType) {
                        $auctiontAlert.show();
                        //$userCommentLabel.text('Название предмета:');
                    } else {
                        //$userCommentLabel.text('Комментарий:');
                    }
                    $loginBlock.hide();
                }
            };

            this.value = function (title) {
                $selectBox.val(title);
            }

            this.setValueByServerCurrency = function(currency) {
                currency = currency || false;
                if (!currency || typeof(serverToValue[currency]) == 'undefined') {
                    return false;
                }
                $tradeInstructions.text('');
                var
                    title     = settings.tradeLocalNames[serverToValue[currency]],
                    tagOption = $('<option value="{value}" selected="selected">{title}</option>'.supplant({ 'value' : serverToValue[currency], 'title' : title }))
                    ;
                $selectBox.empty().append(tagOption);
                if ('brilliant' == currency) {
                    $tradeInstructions.text(AUCTION_INSTRUCTION);
                }
            }
        }

        var OrderFormClass = (function (formSelector) {
            var OrderForm = function (formSelector) {
                this.form      = $(formSelector);
                this.validator = false;
            }
            const errorFindingClassName = 'errorPopover';
            var
                transferType           = new TransferSelectBox('#transfer-type');
                $accumDiscount         = $('#skid_nak'),
                $server                = $('#buy-gold-form-server'),
                $paymentMethod         = $('#buy-payment-method'),
                $currencyQuantity      = $('#buy-gold-form-qty'),
                $currencyQuantityPrice = $('#buy-gold-form-qty-price'),
                $email                 = $('#BillEmail'),
                $phone                 = $('#BillPhoneText'),
                $paymerCard            = $("#buy-paymer"),
                $additionalText        = $("#add_text"),
                $currencyLabel         = $("#currencyLabel"),
                $currencySubLabel      = $("#currencySubLabel"),
                $roboxInnerMethod      = $('#robokassaInnerMethod'),
                $subTotalLabel         = $('#buy-gold-form-sub-count'),
                $serverPriceLabel      = $('#span-server-price'),
                $gameCurrency          = $('#gameCurrency'),
                $checkDiscountButton   = $('#checkButton'),

                pricePerCorrelation = {'brilliant' : 1, 'gold' : 1},
                servers             = settings.servers,
                paymentFactors      = settings.paymentFactors,
                paymentTypes        = payment_types,
                currencyLocalNames  = {'brilliant' : 'бриллиантов', 'gold' : 'золота'},
                currencyPluralNames = {'brilliant' : 'kk бриллиантов', 'gold' : ' золотой'},
                currencyDescription = {'brilliant' : '1 = 1,000,000', 'gold' : '1 = 1,000'},
                topAccumDiscount    = settings.topAccumDiscount.all
            ;

            $currencyLabel.onLabelChange = function(event) {
                var serverData = $server.getData();
                if (false === serverData) {
                    this.text('валюты');
                    $currencySubLabel.html('');
                } else if (typeof(currencyLocalNames[serverData.currency]) != 'undefined') {
                    this.text(currencyLocalNames[serverData.currency]);
                    transferType.setValueByServerCurrency(serverData.currency);
                    $currencySubLabel.html(currencyDescription[serverData.currency]);
                }
            };
            $gameCurrency.onGameChange = function(that, event) {
                $gameCurrency.val($server.getCurrency());
                $currencyQuantity.validateAndHide(that.validator);
            };
            $accumDiscount.onDiscountReceive = function(event, discount) {
                discount = parseInt(discount) || 0;
                this.html('+ накопительная скидка: {discount}%'.supplant({ 'discount' : discount }));
            };
            $server.getData = function() {
                if ($.type(servers[$server.val()]) != 'undefined') {
                    return servers[$server.val()];
                }
                return false;
            };
            $server.getPrice = function() {
                return (this.getData() && this.getData().price);
            };
            $server.getCurrency = function() {
                return (this.getData() && this.getData().currency);
            };
            $.fn.hasChanged = function() {
                if (-1 !== $.inArray($(this).prop('type'), ['button', 'submit'])) {
                    return true;
                }
                var oldValue = $(this).data('oldValue') || '';

                return !(oldValue == $(this).val());
            };

            $.fn.filterByData = function (prop, val, useEquivalent) {
                useEquivalent = useEquivalent || false

                return this.filter( function() {
                    return (useEquivalent ?
                        $(this).data(prop)==val :
                        typeof $(this).data(prop) != "undefined"
                    );
                });
            };
            $.fn.validateAndHide = function (validator) {
                validator = validator || false
                if (validator &&
                    $(this).hasClass(errorFindingClassName)
                    ) {
                    validator.element($(this));
                    //$(this).removeClass(errorFindingClassName).popover('destroy'); //hide is better for performance
                }
            };
            $.fn.getPriceVal = function () {
                var
                    priceVal     = $(this).data('priceValue'),
                    elementValue = $(this).val(),
                    allowableDif = 0.01
                ;
                if ('undefined' != typeof(priceVal) && Math.abs(elementValue - priceVal) < allowableDif) {
                    return priceVal;
                }

                elementValue = ('string' == typeOf(elementValue)) ? elementValue.replace(',', '.') : elementValue;
                return elementValue;
            };
            $.fn.setPriceVal = function (value) {
                value = ('string' == typeOf(value)) ? value.replace(',', '.') : value;
                var
                    floatValue = parseFloat(value),
                    fixedValue = (!isNaN(floatValue) && floatValue > 0) ? floatValue.toFixed(2) : value
                ;
                return $(this).data('priceValue', value).val(fixedValue);
            };

            OrderForm.prototype.initForm = function () {
                transferType.onValueChange();
                $('#buy-gold-form-qty ,#buy-gold-form-server, #buy-payment-method').on('change keyup paste', $.proxy(this.onValuesChange, this, true));
                $currencyQuantityPrice.on('change keyup', $.proxy(this.onValuesChange, this, false));

                $checkDiscountButton.on('click', $.proxy(this.onValuesChange, this, true));

                $currencyLabel.on('label_change', $.proxy($currencyLabel.onLabelChange, $currencyLabel));
                $gameCurrency.on('game_change', $.proxy($gameCurrency.onGameChange, $gameCurrency, this));
                $accumDiscount.on('discount_receive', $.proxy($accumDiscount.onDiscountReceive, $accumDiscount));
                $email.on('blur change', $.proxy(this.onValuesChange, this, true));

                $server.triggerHandler('change');
    //            $currencyLabel.triggerHandler('label_change')
                this.initValidationRules();

            };

            OrderForm.prototype.onValuesChange = function (setQuantityPrice, event) {
                event.preventDefault();
                var $that = $(event.target);
                if (!$that.hasChanged()) {
                    return;
                }
                $currencyLabel.triggerHandler('label_change');
                $gameCurrency.triggerHandler('game_change');

                var ajaxDeferred = this.getDiscount();
                ajaxDeferred.done(function (discount) {
    //                console.log(discount);
                    if (false === setQuantityPrice) {
                        this.recountFromPrice(parseFloat(discount));
                    }
                    this.recount(parseFloat(discount), setQuantityPrice);
                    this.setServerPriceLabel(discount);
                    $accumDiscount.triggerHandler('discount_receive', discount);
                }.bind(this));
                $that.data('oldValue', $that.val());
            };

            OrderForm.prototype.getDiscount = function () {
                var
                    deferred = $.Deferred(),
                    currencyAmount = parseFloat(!$currencyQuantityPrice.getPriceVal() ? 0 : $currencyQuantityPrice.getPriceVal());
    //            if (!currencyAmount) {
    //                return deferred.resolve(0);
    //            }
                var
                    postData = {
                        'email'    : $email.val(),
                        'game'     : 'neverwinter',
                        'money'    : currencyAmount,
                        'currency' : $server.getCurrency()
                    },
                    url = 'modules/mod_form_wow/task/check_ckidka.php',
                    hash = localCache.getHash(url, postData)
                ;

                var beforeSend = function (jqXHR, settings) {
                    if (localCache.exist(this.hash)) {
                        deferred.resolve(localCache.get(this.hash));
                        return false;
                    }
                    return true;
                }.bind({'hash' : hash});

                var setToCache = function (jqXHR, textStatus) {
                    if ("success" == textStatus) {
                        localCache.set(this.hash, jqXHR);
                    }
                }.bind({'hash' : hash});
                $.ajax({
                    'url'        : url,
                    'type'       : 'POST',
                    'data'       : postData,
                    'cache'      : true,
                    'beforeSend' : beforeSend,
                    'success'    : deferred.resolve
                }).always(setToCache);

                return deferred.promise();
            };

            OrderForm.prototype.getPaymentMethod = function () {
                var
                    $element = $paymentMethod.find('option:selected'),
                    method = $element.val()
                    ;
                if ('robox' == method) {
                    var methodTitle = rb_add[$element.html()];
                    if ('WMZ' == methodTitle) {
                        return 'webmoney_z';
                    } else if ('WMR' == methodTitle) {
                        return 'webmoney_r';
                    }
                }

                return method;
            };

            OrderForm.prototype.setExplanations = function (totalCost, paymentMethod, discount) {
                var
                    paymentType                 = paymentTypes[paymentMethod],
                    totalText                   = '<b>{totalCost}</b> {currency}'.supplant({'totalCost' : totalCost.toFixed(2), 'currency' : paymentType.currency}),
                    paymentSystemName           = $paymentMethod.find('option:selected').text(),
                    commission                  = paymentFactors[paymentMethod],
                    commissionText              = '',
                    paymentHelpTemplate         = 'Если у вас возникают сложности при оплате {paymentSystemName}, пожалуйста, обратитесь в <a href="#" class="text" onclick="supportAPI.openSupport(); return false;">онлайн чат</a> за дополнительной консультацией',
                    commissionTextTemplate      = "(цена с учетом комиссии {commission}%)",
                    commissionRobokassaTemplate = '<br />с комиссией RoboxChange (~10.8%)',
                    totalTextRobokassaTemplate  = '<b>{priceWithCommission} {currency} (цена указана с учетом комиссии {commissionPercent}% RoboxChange</b>',
                    subTotalTemplate            = 'Итого: {totalText} {commissionText}'
                    ;
                $phone.html('Телефон:');
                $paymerCard.hide();
                $additionalText.html(paymentHelpTemplate.supplant({'paymentSystemName' : paymentSystemName})).show();

                if (paymentFactors[paymentMethod] > 1) {
                    commission = ((paymentFactors[paymentMethod] - 1) * 100).toFixed(0),
                        commissionText = commissionTextTemplate.supplant({'commission' : commission});
                }
                switch (paymentMethod) {
                    case 'yandex_manual':
                        commissionText = commissionRobokassaTemplate;
                        $roboxInnerMethod.val('YandexMerchantR');
                        break;
                    case 'qiwi':
                        $phone.html('Телефон: *');
                        break;
                    case 'paymer_wmr':
                    case 'paymer_wmz':
                        $paymerCard.css({'display' : 'table-row'});
                        break;
                    case 'robox':
                    case 'webmoney_r':
                        commission = roboxComiss[paymentSystemName];
                        var priceWithCommission = (totalCost * commission).toFixed(2);
                        var commissionPercent = ((parseFloat(commission) - 1) * 100).toFixed(2);
                        totalText = totalTextRobokassaTemplate.supplant({'priceWithCommission' : priceWithCommission, 'currency' : paymentType.currency, 'commissionPercent' : commissionPercent});
                        $roboxInnerMethod.val(rb_add[paymentSystemName]);
                        break;
                }
                $subTotalLabel.html(subTotalTemplate.supplant({'totalText' : totalText, 'commissionText' : commissionText}));
            };

            OrderForm.prototype.setServerPriceLabel = function (discount) {
                var serverData = $server.getData();
                if (!serverData) {
                    return $serverPriceLabel.text('');
                }
                if ('undefined' == typeof discount) {
                    discount = 1;
                } else {
                    discount = (100 - discount) / 100;
                }

                var
                    pricePerLabel = serverData && 'за {x}{y}'.supplant({'x' : pricePerCorrelation[serverData.currency], 'y' : currencyPluralNames[serverData.currency]}),
                    priceLabelTemplateFull  = 'Стоимость: от <b>{priceFrom}</b>р. до <b>{priceTo}</b>р. {pricePerLabel}'.supplant({'pricePerLabel' : pricePerLabel}),
                    priceLabelTemplateShort = 'Стоимость: от <b>{priceFrom}</b>р. {pricePerLabel}'.supplant({'pricePerLabel' : pricePerLabel}),
                    priceTo   = $server.getPrice(),
                    priceFrom = (priceTo * discount).toFixed(2)
                ;
                var maxAccumFactor = ('undefined' != typeof(topAccumDiscount)) ? parseFloat(topAccumDiscount) : 1;

                if (!$currencyQuantity.getPriceVal()) {
                    if (1 == discount) {
                        priceFrom = (priceTo * maxAccumFactor * discount).toFixed(2);
                        return $serverPriceLabel.html(priceLabelTemplateFull.supplant({'priceFrom' : priceFrom, 'priceTo' : priceTo}));
                    }
                    return $serverPriceLabel.html(priceLabelTemplateFull.supplant({'priceFrom' : priceFrom, 'priceTo' : priceTo}));
                }
                return $serverPriceLabel.html(priceLabelTemplateShort.supplant({'priceFrom' : priceFrom, 'priceTo' : priceTo}));
            };

            OrderForm.prototype.recount = function (discount, setQuantityPrice) {
                var serverId = $server.find('option:selected').val();
                if (!serverId) {
                    return false;
                }
                var server    = servers[serverId],
                    pricePer  = (typeof(server) == 'undefined') ? 1000 :
                        pricePerCorrelation[server.currency],
                    post_text = '',
                    method    = this.getPaymentMethod(),
                    quantity  = $currencyQuantity.getPriceVal(),
                    total     = 0
                    ;

                quantity = parseFloat(quantity * paymentFactors[method]);
                total    = parseFloat(quantity * server.price / pricePer);
                if ('undefined' != typeof(discount) && discount > 0) {
                    total = parseFloat(total * ((100 - discount) / 100));
                }

                this.setExplanations(total, method, discount);
                if (setQuantityPrice) {
                    total = (!total) ? '' : total;
                    $currencyQuantityPrice.setPriceVal(total);
                }
            };

            OrderForm.prototype.recountFromPrice = function (discount) {
                var serverData = $server.getData();
                if (!serverData) {
                    return false;
                }
                var pricePer  = (typeof(pricePerCorrelation[serverData.currency]) == 'undefined') ? 1000 : pricePerCorrelation[serverData.currency];
                var price     = serverData.price / pricePer;
                var currencyQuantity = parseFloat($currencyQuantityPrice.getPriceVal() / (price * (100 - discount)/100)); // количество валюты

                return $currencyQuantity.setPriceVal(currencyQuantity);
            };

            OrderForm.prototype.initValidationRules = function () {
                var getLimits = function () {
                    var currency = $server.getCurrency();
                    if (!currency) {
                        return false;
                    }
                    return {
                        'minCount' : settings.minLimitations['min_cost_neverwinter_' + currency],
                        'currency' : currencyPluralNames[currency]
                    }
                };
    //            var minimalLimitValidation = function(element) {
                var getMinimalCount = function(element) {
                    var limits = getLimits();
                    return (limits && limits.minCount);
                };
                var getMinimalCurrency = function(element) {
                    var currency = $server.getCurrency();
                    return (currency && currencyPluralNames[currency]);
                };
                var validationDependencies = function(validatorName, element) {
                    switch (validatorName) {
                        case 'phone'  : return ('qiwi' == this.getPaymentMethod());
                            break;
                        case 'paymer' : return (-1 !== $.inArray(this.getPaymentMethod(), ['paymer_wmr', 'paymer_wmz']));
                            break;
                        case 'quantity' : return (false !== $server.getData());
                        break;
                    }
                };
                var getMinimalErrorMessage = function() {
                    var minCount = getMinimalCount();
                    var currency = ('gold' == $server.getCurrency()) ? pluralString(minCount, 'золотой', 'золотых', 'золотых') : getMinimalCurrency();

                    return 'Минимальная сумма покупки: {minCount} {currency}'.supplant({ 'minCount' :  minCount, 'currency' :  currency});
                };
                var showErrorsHandler = function(errorMap, errorList) {
                    for (var i = 0; i < errorList.length; i++) {
                        var item = errorList[i];
                        if ( this.settings.highlight ) {
                            this.settings.highlight.call( this, item );
                        }
                    }
                    if ( this.settings.unhighlight ) {
                        for ( i = 0, elements = this.validElements(); elements[i]; i++ ) {
                            this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
                        }
                    }
    //                    this.defaultShowErrors();
                };
                $.validator.addMethod("phoneRu", function(value, element, params) {
                    return value.test(/^\d{10}$/);
                });
                $.validator.addMethod("minimalLimits", function(value, element, params) {
                    return value >= parseFloat(getMinimalCount());
                }, getMinimalErrorMessage);

                var validatorParams = {
    //                'onfocusout' : false,
                    //'onkeyup'  : false,
    //                'errorLabelContainer': "#error",
                    'errorClass': "invalid",
                    'rules': {
                        'data[Bill][email]' : {
                            'required' : true,
                            'email'    : true
                        },
                        'data[Character][character]' : 'required',
                        'data[Character][server_id]' : 'required',
                        'data[Character][qty]' : {
    //                        'required'     : true,
                            'minimalLimits' :  {
                                'depends' : $.proxy(validationDependencies, this, 'quantity')
                            }
    //                        'min' : getMinimalCount
                        },
                        'data[Bill][Phone]' : {
                            'required' :{
                                'depends' : $.proxy(validationDependencies, this, 'phone')
                            },
                            'phoneRu' : {
                                'depends' : $.proxy(validationDependencies, this, 'phone')
                            }
                        },
                        'data[Bill][Paymer_Num]' : {
                            'required' : {
                                'depends' : $.proxy(validationDependencies, this, 'paymer')
                            }
                        }
                    },
                    'messages': {
                        'data[Bill][email]': {
                            required: 'Укажите свой email',
                            email	: 'Нужно указать корректный email адрес'
                        },
                        'data[Character][character]': 'Укажите имя персонажа',
                        'data[Character][server_id]' : 'Выберите сервер',
                        'data[Character][qty]' : {
                            'required' : 'Выберите сумму золота или сколько хотите заплатить'
                        },
                        'data[Bill][Phone]' : {
                            'required' : 'Укажите номер телефона от qiwi-кабинета',
                            'phoneRu'  : 'Неправильный формат телефонного номера (только 11 цифр).'
                        },
                        'data[Bill][Paymer_Num]' : {
                            'required' : 'Карты номер или чека paymer ввести необходимо'
                        }
                    },
                    highlight: function(errorItem) {
                        var popoverSettings = {
                            //        'toggle' : 'popover',
                            'trigger'   : 'manual',
                            'content'   : 'error',
                            'placement' : 'auto left',
                            'container' : 'body'
                        };
                        popoverSettings.content = $.isFunction(errorItem.message) ? errorItem.message() : errorItem.message;
                        $(errorItem.element).addClass(errorFindingClassName).popover('destroy').popover(popoverSettings).popover('show');
                    },
                    unhighlight: function(element, errorClass, validClass) {
                        $(element).popover('destroy');
                    },
                    'showErrors': showErrorsHandler
                    //'submitHandler' : that.submitHandler
                };

                this.validator = this.form.validate(validatorParams);
            };



            var orderForm = new OrderForm(formSelector);
            orderForm.Constructor = OrderForm;

            return orderForm;
        });

        $().ready(function () {
            var orderForm = new OrderFormClass('#zakaz');
            orderForm.initForm();
        });
    })(jQuery);